package com.example.demo.dao;

import com.example.demo.entity.Customer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

import java.util.List;
@Repository
public class CustomerDaoImpl implements CustomerDao{

    @Autowired
    JdbcTemplate jdbcTemplate;
    @Override
    public List<Customer> getCustomer() {
        String sql = "select * from customer";
        return jdbcTemplate.query(sql,new BeanPropertyRowMapper<>(Customer.class));
    }
}
